import 'package:flutter/material.dart';
import 'package:flutter_eve_plugin/constants/font_family.dart';
import 'package:flutter_eve_plugin/constants/font_weight.dart';
import 'package:flutter_eve_plugin/pages/main/actions.dart';
import 'package:flutter_eve_plugin/utils/image_util.dart';
import 'package:flutter_eve_plugin/utils/screen_util.dart';

AppBar buildNewMainAppBar(int curr, int total) {
  return AppBar(
      backgroundColor: Colors.transparent,
      elevation: 0,
      actions: <Widget>[
        Padding(
          padding: EdgeInsets.only(right: setRatio(12), top: setRatio(19)),
          child: Stack(
            overflow: Overflow.visible,
            children: <Widget>[
              Container(
                width: setRatio(105),
                height: setRatio(21),
                decoration: BoxDecoration(
                    image: DecorationImage(
                        image: AssetImage(
                            imageUtilYeXiu('main/icon_nav_right_bg2@3x')))),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.start,
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: <Widget>[
                    SizedBox(
                      width: setRatio(5),
                    ),
                    Image.asset(
                      imageUtilYeXiu(
                          'main/icon_nav_right_physical_strength2@3x'),
                      width: setRatio(17),
                      height: setRatio(17),
                    ),
                    Text(
                      '${curr ?? 0}/${total ?? 0}',
                      style: TextStyle(
                          fontFamily: FontFamily.PINGFANG,
                          fontWeight: FontWeightCustom.PF_Medium,
                          fontSize: setTextSp(10),
                          color: Color(0xFFFFFFFF)),
                    )
                  ],
                ),
              ),
              Positioned(
                right: 0,
                top: setRatio(-3),
                child: Image.asset(
                  imageUtilYeXiu('main/icon_nav_right_add2@3x'),
                  width: setRatio(26),
                  height: setRatio(26),
                ),
              )
            ],
          ),
        )
      ],
      leading: Builder(
        builder: (BuildContext context) {
          return IconButton(
            icon: Image.asset(
              imageUtilYeXiu('main/icon_back3@3x'),
              width: setRatio(35),
              height: setRatio(32),
            ),
            onPressed: () {
              Navigator.canPop(context)
                  ? Navigator.pop(context)
                  : goBackNative();
            },
          );
        },
      ));
}

AppBar buildMainAppBar(int curr, int total) {
  return AppBar(
      backgroundColor: Colors.transparent,
      elevation: 0,
      actions: <Widget>[
        Padding(
          padding: EdgeInsets.only(right: setRatio(12), top: setRatio(19)),
          child: Stack(
            overflow: Overflow.visible,
            children: <Widget>[
              Container(
                width: setRatio(105),
                height: setRatio(21),
                decoration: BoxDecoration(
                    image: DecorationImage(
                        image: AssetImage(
                            imageUtilYeXiu('main/icon_nav_right_bg@3x')))),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.start,
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: <Widget>[
                    Image.asset(
                      imageUtilYeXiu(
                          'main/icon_nav_right_physical_strength@3x'),
                      width: setRatio(17),
                      height: setRatio(17),
                    ),
                    Text(
                      '${curr ?? 0}/${total ?? 0}',
                      style: TextStyle(
                          fontFamily: FontFamily.PINGFANG,
                          fontWeight: FontWeightCustom.PF_Medium,
                          fontSize: setTextSp(10),
                          color: Color(0xFFFFFFFF)),
                    )
                  ],
                ),
              ),
              Positioned(
                right: 0,
                top: setRatio(-3),
                child: Image.asset(
                  imageUtilYeXiu('main/icon_nav_right_add@3x'),
                  width: setRatio(26),
                  height: setRatio(26),
                ),
              )
            ],
          ),
        )
      ],
      leading: Builder(
        builder: (BuildContext context) {
          return IconButton(
            icon: Image.asset(
              imageUtilYeXiu('main/icon_back3@3x'),
              width: setRatio(35),
              height: setRatio(32),
            ),
            onPressed: () {
              Navigator.canPop(context)
                  ? Navigator.pop(context)
                  : goBackNative();
            },
          );
        },
      ));
}

AppBar buildBackAppBar() {
  return AppBar(
      backgroundColor: Colors.transparent,
      elevation: 0,
      leading: Builder(
        builder: (BuildContext context) {
          return IconButton(
            icon: Image.asset(
              imageUtilYeXiu('main/icon_back3@3x'),
              width: setRatio(35),
              height: setRatio(32),
            ),
            onPressed: () {
              Navigator.canPop(context)
                  ? Navigator.pop(context)
                  : goBackNative();
            },
          );
        },
      ));
}
